import {RouteRecordRaw} from 'vue-router';
import {Layout} from '@/router/constant';
import {LiveTvSharp} from '@vicons/material';
import {renderIcon} from '@/utils/index';

const routeName = 'liveBroadcast';

/**
 * @param name 路由名称, 必须设置,且不能重名
 * @param meta 路由元信息（路由附带扩展信息）
 * @param redirect 重定向地址, 访问这个路由时,自定进行重定向
 * @param meta.disabled 禁用整个菜单
 * @param meta.title 菜单名称
 * @param meta.icon 菜单图标
 * @param meta.keepAlive 缓存该路由
 * @param meta.sort 排序越小越排前
 * */
const routes: Array<RouteRecordRaw> = [
  {
    path: '/liveBroadcast',
    name: routeName,
    redirect: '/liveBroadcast/anchorBill',
    component: Layout,
    meta: {
      title: '账单',
      icon: renderIcon(LiveTvSharp),
      permissions: ['liveBroadcast_anchorBill', 'player_playerRole','liveBroadcast_anchordaily','liveBroadcast_anchorDailyRecords'],
      sort: 6,
    },
    children: [
      {
        path: 'anchorBill',
        name: `${routeName}_anchorBill`,

        meta: {
          title: '主播账单',
          permissions: ['liveBroadcast_anchorBill'],
          keepAlive: false,
        },
        component: () => import('@/views/liveBroadcast/anchorBill/anchorBill.vue')
      },
      {
        path: 'gameBill',
        name: `${routeName}_gameBill`,

        meta: {
          title: '游戏账单',
          permissions: ['liveBroadcast_gameBill'],
          keepAlive: false,
        },
        component: () => import('@/views/liveBroadcast/gameBill/gameBill.vue')
      },
      {
        path: 'anchor',
        name: `${routeName}_anchor`,

        meta: {
          title: '主播管理',
          permissions: ['liveBroadcast_anchor'],
          keepAlive: false,
        },
        component: () => import('@/views/liveBroadcast/anchorManage/anchorManage.vue')
      },
      {
        path: 'dayBill',
        name: `${routeName}_dayBill`,
        meta: {
            title: '主播管理',
            permissions: ['liveBroadcast_dayBill'],
            keepAlive: false,
        },
        component: () => import('@/views/liveBroadcast/dayBill/dayBill.vue')
    },
    {
      path: 'anchorDaily',
      name: `${routeName}_anchorDaily`,

      meta: {
        title: '主播每日数据',
        permissions: ['liveBroadcast_anchorDaily'],
        keepAlive: false,
      },
      component: () => import('@/views/liveBroadcast/anchorDaily/anchorDaily.vue')
    },
    {
      path: 'anchorDailyRecords/:id/:name',
      name: `${routeName}_anchorDailyRecords`,

      meta: {
        title: '详情',
        permissions: ['liveBroadcast_anchorDailyRecords'],
        hidden: true,
        activeMenu: 'liveBroadcast_anchorDaily',
      },
      component: () => import('@/views/liveBroadcast/anchorDaily/anchorDailyRecords.vue')
    },
    ],
  },
];

export default routes;
